package com.liyou.process.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liyou.auth.service.SysUserService;
import com.liyou.model.process.ProcessRecord;
import com.liyou.model.system.SysUser;
import com.liyou.process.service.OaProcessRecordService;
import com.liyou.process.mapper.OaProcessRecordMapper;
import com.liyou.security.custom.LoginUserInfoHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* @author asus
* @description 针对表【oa_process_record(审批记录)】的数据库操作Service实现
* @createDate 2023-06-10 14:45:39
*/
@Service
public class OaProcessRecordServiceImpl extends ServiceImpl<OaProcessRecordMapper, ProcessRecord>
    implements OaProcessRecordService{

    @Resource
    private SysUserService sysUserService;

    @Override
    public void record(Long processId, Integer status, String description) {
        Long userId = LoginUserInfoHelper.getUserId();
        SysUser sysUser = sysUserService.getById(userId);
        ProcessRecord processRecord = new ProcessRecord();
        processRecord.setProcessId(processId);
        processRecord.setStatus(status);
        processRecord.setDescription(description);
        processRecord.setOperateUser(sysUser.getName());
        processRecord.setOperateUserId(userId);
        baseMapper.insert(processRecord);
    }
}




